package com.bicon.botu.mall.order.api;

import com.bicon.botu.core.base.common.controller.BaseController;
import com.bicon.botu.core.base.common.entity.BaseResult;
import com.bicon.botu.mall.order.service.IOrderDeliverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 李双喜
 * @since 2018-05-14
 */
@RestController
@RequestMapping("/V3.0.0/api/order-deliver")
public class OrderDeliverApiV3 extends BaseController {
    @Autowired
    private IOrderDeliverService iOrderDeliverService;

    /**
     * 订单确认完成
     *
     * @param orderGoodsId 分组订单id
     * @return
     */
    @RequestMapping("/completion")
    public BaseResult orderCompletion(@RequestParam String orderGoodsId) {
        Boolean result = iOrderDeliverService.orderCompletion(orderGoodsId,getUserId());
        if (result) {
            return new BaseResult(200, "success", result);
        }
        return new BaseResult(500, "error");
    }


    @Autowired
    private IOrderDeliverService orderDeliverService;

    @RequestMapping(value = "/logistics",method = RequestMethod.GET)
    public BaseResult getLogistics(@RequestParam("orderId") String orderId) {
        return sendResult200(this.orderDeliverService.getLogistics(orderId));
    }

}
